

*********************************************************************
*Purpose: Run all analyses in paper and supporting information (SI)**
*Stata Version: 17
*By Marc van de Wardt (m.p.vande.wardt@vu.nl)
*********************************************************************

**Install additional packages needed

ssc install blindschemes, replace
net install blindschemes_fix, replace from("http://digital.cgdev.org/doc/stata/MO/Misc")
ssc install estout, replace

**Set working directory

cd "C:\Users\LT-054912\surfdrive\Voting for niche parties\dataverse files\"

**Open log file

log using "Stata commands to replicate all analyses.smcl", replace

************
**Figure 2**
************

use "data for analysis.dta", clear

preserve

drop if c_niche>=. | male>=. | age>=. | highedu>=. | income_3cat>=. | dissatisfied>=. | closeparty>=. | distpreviouspartycmp>=. | p_government>=. | ///
lvotetotniche_combined>=. | lpss_mod3_upd>=. | sd_rile>=. | p_niche>=. | country_elec>=.
egen zage = std(age)
label var zage "Age"
egen zdistpreviouspartycmp = std(distpreviouspartycmp)
label var zdistpreviouspartycmp "Left/right distance party t-1"
egen zsd_rile = std(sd_rile)
label var zsd_rile "Polarization mainstream parties"
egen zlvotetotniche_combined = std(lvotetotniche_combined)
label var zlvotetotniche_combined "Vote share niche parties t-1"
egen zlpss_mod3_upd = std(lpss_mod3_upd)
label var zlpss_mod3_upd "Party system saturation t-1"
melogit c_niche male zage i.highedu i.income_3cat dissatisfied zdistpreviouspartycmp closeparty p_government zsd_rile zlvotetotniche_combined zlpss_mod3_upd ///
if p_niche==0 || country_elec:, or vce(robust)
est store M1
coefplot, eform drop(_cons) xline(1) title("Mainstream to Niche") xlabel(0 (.5) 2) scheme(plotplain) name(figure2_a, replace)
melogit c_mainstream male zage i.highedu i.income_3cat dissatisfied zdistpreviouspartycmp closeparty p_government zsd_rile zlvotetotniche_combined zlpss_mod3_upd ///
if p_niche==1 || country_elec:, or vce(robust)
est store M2
coefplot, eform drop(_cons) xline(1) title("Niche to Mainstream") xlabel(0 (.5) 2) scheme(plotplain) name(figure2_b, replace)
graph combine figure2_a figure2_b, scheme(plotplain)
graph export "figure2.tif", replace

restore

*************************
**Figure 3 and Table A5**
*************************

preserve

***Figure 3

drop if c_niche>=. | male>=. | age>=. | highedu>=. | income_3cat>=. | dissatisfied>=. | closeparty>=. | distpreviouspartycmp>=. | p_government>=. | ///
lvotetotniche_combined>=. | lpss_mod3_upd>=. | sd_rile>=. | p_niche>=. | country_elec>=.
egen zage = std(age)
label var zage "Age"
egen zdistpreviouspartycmp = std(distpreviouspartycmp)
label var zdistpreviouspartycmp "Left/right distance party t-1"
egen zsd_rile = std(sd_rile)
label var zsd_rile "Polarization mainstream parties"
egen zlvotetotniche_combined = std(lvotetotniche_combined)
label var zlvotetotniche_combined "Vote share niche parties t-1"
egen zlpss_mod3_upd = std(lpss_mod3_upd)
label var zlpss_mod3_upd "Party system saturation t-1"
egen zlvotetotradicallr_combined = std(lvotetotradicallr_combined)
label var zlvotetotradicallr_combined "Vote share radical parties t-1"
egen zlvotetotgreen_combined = std(lvotetotgreen_combined)
label var zlvotetotgreen_combined "Vote share green parties t-1"
melogit c_radicalrl_vs_mainstream male zage i.highedu dissatisfied i.income_3cat zdistpreviouspartycmp closeparty p_government zsd_rile zlvotetotradicallr_combined zlpss_mod3_upd ///
if p_radicalrl_vs_mainstream==0 || country_elec:, or vce(robust)
est store M3
coefplot, eform drop(_cons) xline(1) title("Mainstream to Radical") xlabel(0 (1) 5) scheme(plotplain) name(figure4_1, replace)
melogit c_mainstream_vs_radicalrl zage zage i.highedu dissatisfied i.income_3cat zdistpreviouspartycmp closeparty p_government zsd_rile zlvotetotradicallr_combined zlpss_mod3_upd ///
if p_radicalrl_vs_mainstream==1 || country_elec:, or vce(robust)
est store M4
coefplot, eform drop(_cons) xline(1) title("Radical to Mainstream") xlabel(0 (1) 5) scheme(plotplain) name(figure4_2, replace)
melogit c_green_vs_mainstream male zage i.highedu dissatisfied i.income_3cat zdistpreviouspartycmp closeparty p_government zsd_rile zlvotetotgreen_combined zlpss_mod3_upd ///
if p_green_vs_mainstream==0 || country_elec:, or vce(robust)
est store M5
coefplot, eform drop(_cons) xline(1) title("Mainstream to Green") xlabel(0 (1) 13) scheme(plotplain) name(figure4_3, replace)
melogit c_mainstream_vs_green male zage i.highedu dissatisfied i.income_3cat zdistpreviouspartycmp closeparty p_government zsd_rile zlvotetotgreen_combined zlpss_mod3_upd ///
if p_green_vs_mainstream==1 || country_elec:, or vce(robust)
est store M6
coefplot, eform drop(_cons) xline(1) title("Green to Mainstream") xlabel(0 (1) 5) scheme(plotplain) name(figure4_4, replace)
graph combine figure4_1 figure4_2 figure4_3 figure4_4, scheme(plotplain)
graph export "figure3.tif", replace

***Table A5
esttab M1 M2 M3 M4 M5 M6 using "tablea5.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A5. Standardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

restore

************
**Figure 4**
************

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
sum lpss_mod3_upd if e(sample)==1, d
margins, at(lpss_mod3_upd=(-4(0.5)2.5)) vsquish post
marginsplot, yline(0) ylabel(0(.1).5, nogrid angle(0)) plotregion(color(white)) graphregion(color(white)) 	///
xlabel(-4(0.5)2.5) 												///
recast(line) recastci(rline) 									///
plot1opts(lcolor(black) clpattern(line) lwidth(medthick)) 						///
ci1opts (lcolor(black) clpattern(line) lpattern(dash) color(black) lwidth(medthick)) 				///
xtitle("Party system saturation t-1") ytitle("Predicted probability of switching", margin(0 0 0 0)) title("Mainstream to Radical") nolab ///
addplot(hist lpss_mod3_upd if e(sample)==1, percent bin(30) yaxis(2) ylabel(0(.1).5, nogrid angle(0)) xlabel(-4(0.5)2.5) lcolor(gs10) bfcolor(none) ///
yscale(line alt axis(2)) ytitle("Percentage party system saturation", axis(2))) legend(off) scheme(plotplain) name(predicted1, replace)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
margins, at(lpss_mod3_upd=(-4(0.5)2.5)) vsquish post
marginsplot, yline(0) ylabel(0(.1).5, nogrid angle(0)) plotregion(color(white)) graphregion(color(white)) 	///
xlabel(-4(0.5)2.5) 												///
recast(line) recastci(rline) 									///
plot1opts(lcolor(black) clpattern(line) lwidth(medthick)) 						///
ci1opts (lcolor(black) clpattern(line) lpattern(dash) color(black) lwidth(medthick)) 				///
xtitle("Party system saturation t-1") ytitle("Predicted probability of switching", margin(0 0 0 0)) title("Radical to Mainstream") nolab ///
addplot(hist lpss_mod3_upd if e(sample)==1, percent bin(30) yaxis(2) ylabel(0(.1).5, nogrid angle(0)) xlabel(-4(0.5)2.5) lcolor(gs10) bfcolor(none) ///
yscale(line alt axis(2)) ytitle("Percentage party system saturation", axis(2))) legend(off) scheme(plotplain) name(predicted2, replace)
graph combine predicted1 predicted2, scheme(plotplain)
graph export "figure4.tif", replace

************
**Figure 6**
************

/*Based on coefficients in Table A21*/

mlogit c_radmainvsniche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
, baseoutcome(3) vce(cluster country_elec)
estadd scalar N_elections = e(N_clust)
est store M1
qui su lpss_mod3_upd if e(sample)==1, d
margins, at(lpss_mod3_upd =(`r(p25)' `r(p75)')) predict(outcome(1)) pwcompare post
gen b=el(e(b_vs),1,1) in 3
gen se=el(e(V_vs),1,1) in 3

mlogit c_radmainvsniche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
, baseoutcome(3) vce(cluster country_elec)
qui su lpss_mod3_upd if e(sample)==1, d
margins, at(lpss_mod3_upd =(`r(p25)' `r(p75)')) predict(outcome(2)) pwcompare post
replace b=el(e(b_vs),1,1) in 2
replace se=el(e(V_vs),1,1) in 2

mlogit c_radmainvsniche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
, baseoutcome(3) vce(cluster country_elec)
qui su lpss_mod3_upd if e(sample)==1, d
margins, at(lpss_mod3_upd =(`r(p25)' `r(p75)')) predict(outcome(3)) pwcompare post
replace b=el(e(b_vs),1,1) in 1
replace se=el(e(V_vs),1,1) in 1

gen lo=(b - 1.96*sqrt(se)) 
gen hi=(b + 1.96*sqrt(se)) 

gen vertical=_n
replace vertical=. if vertical>3

twoway (scatter vertical b, msymbol(circle) mcolor(black)) ///
(rcap lo hi vertical, lpattern(solid)lcolor(black) horizontal msize(zero)) ///
, ylabel(3 "Radical right or left party" ///
2 "Radical mainstream party (+ 1 SD)" ///
1 "Non-radical mainstream party (< 1SD)" ///
, angle(0) valuelabel ) ///
xtitle(Increase in pred. probability) xline(0, lpattern(dash) lcolor(red)) ytitle("") xtitle(, size(medsmall)) title("") legend(off) ///
scheme(plotplain) aspectratio(2) name(a, replace)
graph export "figure6.tif", replace

************
**Table A6**
************

/*Figure 4 is based on the coefficients of M3 and M4 below*/

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_niche==0 ///
|| country_elec:, or vce(robust)
est store M1
gen mainniche2=e(sample)
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_niche==1 ///
|| country_elec:, or vce(robust)
est store M2
gen nichemain2=e(sample)
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
gen mainradical2=e(sample)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
gen radicalmain2=e(sample)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M5
gen maingreen2=e(sample)
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
gen greenmain2=e(sample)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea6.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A6. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

***************
***Table A4***
***************

preserve

keep if (mainniche2==1 | nichemain2==1)

tab highedu, gen(edudum)
tab income_3cat, gen(incdum)

capture drop mainniche nichemain mainradical radicalmain maingreen greenmain

gen mainniche=0
replace mainniche=1 if c_niche==1 & p_niche==0

gen nichemain=0
replace nichemain=1 if c_mainstream==1 & p_niche==1

gen mainradical=0
replace mainradical=1 if c_radicalrl_vs_mainstream==1 & p_radicalrl_vs_mainstream==0

gen radicalmain=0
replace radicalmain=1 if c_mainstream_vs_radicalrl==1 & p_radicalrl_vs_mainstream==1
 
gen maingreen=0
replace maingreen=1 if c_green_vs_mainstream==1 & p_green_vs_mainstream==0

gen greenmain=0
replace greenmain=1 if c_mainstream_vs_green==1 & p_green_vs_mainstream==1

label var mainniche "Mainstream to niche"
label var nichemain "Niche to mainstream"
label var mainradical "Mainstream to radical"
label var radicalmain "Radical to mainstream"
label var maingreen "Mainstream to green"
label var greenmain "Green to mainstream"

keep mainniche nichemain mainradical radicalmain maingreen greenmain incdum* edudum* male dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd 

asdoc sum, save(tablea4.rtf) label

restore

************
**Table A7**
************

melogit c_niche male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_niche==0 ///
|| country_elec:, or vce(robust)
est store M1
tab country elec_year if e(sample)==1 & dataset=="EV"
tab country if e(sample)==1
gen mainniche=e(sample)
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_niche==1 ///
|| country_elec:, or vce(robust)
gen nichemain=e(sample)
estadd scalar N_elections = e(N_clust)
est store M2

melogit c_radicalrl_vs_mainstream male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
gen mainradical=e(sample)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
gen radicalmain=e(sample)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M5
gen maingreen=e(sample)
estadd scalar N_elections= e(N_clust)

melogit c_mainstream_vs_green male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
gen greenmain=e(sample)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea7.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A7. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

************
**Table A8**
************

melogit c_comm_vs_mainstream_left male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_comm_vs_mainstream_left==0 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)
melogit c_mainstream_left_vs_comm male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_comm_vs_mainstream_left==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)
melogit c_rr_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_rr_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)
melogit c_mainstream_vs_rr male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_rr_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 using "tablea8.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Radical left" "Radical left-->Main" "Main-->Radical right" "Radical right-->Main") scalar(N_elections) title(Table A8. Individual families (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1) replace

************
**Table A9**
************

melogit c_green_vs_mainstream_left male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream_left==0 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_left_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream_left==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream_right male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream_right==0 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_right_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream_right==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 using "tablea9.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main left-->Green)" "Green-->Main left" "Main right-->Green" "Green-->Main right") scalar(N_elections) title(Table A9. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1) replace

*************
**Table A10**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvol_switch lpss_mod3_upd if p_niche==0 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvol_switch lpss_mod3_upd if p_niche==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvol_switch lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvol_switch lpss_mod3_upd if p_radicalrl_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvol_switch lpss_mod3_upd if p_green_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvol_switch lpss_mod3_upd if p_green_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea10.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A10. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A11**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvol_close lpss_mod3_upd if p_niche==0 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvol_close lpss_mod3_upd if p_niche==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvol_close lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvol_close lpss_mod3_upd if p_radicalrl_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvol_close lpss_mod3_upd if p_green_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvol_close lpss_mod3_upd if p_green_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea11.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A11. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A12**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined gparties llsq lpss_mod3_upd if p_niche==0 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined gparties llsq lpss_mod3_upd if p_niche==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined gparties llsq lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined gparties llsq lpss_mod3_upd if p_radicalrl_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined gparties llsq lpss_mod3_upd if p_green_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined gparties llsq lpss_mod3_upd if p_green_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea12.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A12. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A13**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_rr if p_niche==0 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_rr if p_niche==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_rr if p_radicalrl_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_rr if p_radicalrl_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_rr if p_green_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_rr if p_green_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea13.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A13. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A14**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_higher if p_niche==0 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_higher if p_niche==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_higher if p_radicalrl_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_higher if p_radicalrl_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_higher if p_green_vs_mainstream==0 ///
|| country_elec:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_higher if p_green_vs_mainstream==1 ///
|| country_elec:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea14.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A14. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A15**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lenep_new if p_niche==0 & mainniche2==1 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lenep_new if p_niche==1 & nichemain2==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lenep_new if p_radicalrl_vs_mainstream==0 & mainradical2==1 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lenep_new if p_radicalrl_vs_mainstream==1 & radicalmain2==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lenep_new if p_green_vs_mainstream==0 & maingreen2==1 ///
|| country_elec:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lenep_new if p_green_vs_mainstream==1 & greenmain2==1 ///
|| country_elec:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea15.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A15. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A16**
************* 

melogit c_niche male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lenep_new if p_niche==0 & mainniche==1 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lenep_new if p_niche==1 & nichemain==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lenep_new if p_radicalrl_vs_mainstream==0 & mainradical==1 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lenep_new if p_radicalrl_vs_mainstream==1 & radicalmain==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lenep_new if p_green_vs_mainstream==0 & maingreen==1 ///
|| country_elec:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lenep_new if p_green_vs_mainstream==1 & greenmain==1 ///
|| country_elec:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea16.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A16. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A17**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined mean_min_eucl if p_niche==0 & mainniche2==1 ///
|| country_elec:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined mean_min_eucl if p_niche==1 & nichemain2==1 ///
|| country_elec:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined mean_min_eucl if p_radicalrl_vs_mainstream==0 & mainradical2==1 ///
|| country_elec:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined mean_min_eucl if p_radicalrl_vs_mainstream==1 & radicalmain2==1 ///
|| country_elec:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined mean_min_eucl if p_green_vs_mainstream==0 & maingreen2==1 ///
|| country_elec:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined mean_min_eucl if p_green_vs_mainstream==1 & greenmain2==1 ///
|| country_elec:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea17.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A17. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A18**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_niche==0 ///
|| ccode: || country_elec:, or vce(robust)
est store M1
estadd scalar N_countries = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_niche==1 ///
|| ccode: || country_elec:, or vce(robust)
est store M2
estadd scalar N_countries = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
|| ccode: || country_elec:, or vce(robust)
est store M3
estadd scalar N_countries = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==1 ///
|| ccode: || country_elec:, or vce(robust)
est store M4
estadd scalar N_countries = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream==0 ///
|| ccode: || country_elec:, or vce(robust)
est store M5
estadd scalar N_countries = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd if p_green_vs_mainstream==1 ///
|| ccode: || country_elec:, or vce(robust)
est store M6
estadd scalar N_countries = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea18.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_countries) title(Table A18. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A19**
*************

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd i.country_elec if p_niche==0 ///
|| ccode:, or vce(robust)
est store M1
estadd scalar N_elections = e(N_clust)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd i.country_elec if p_niche==1 ///
|| ccode:, or vce(robust)
est store M2
estadd scalar N_elections = e(N_clust)

melogit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd i.country_elec if p_radicalrl_vs_mainstream==0 ///
|| ccode:, or vce(robust)
est store M3
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined lpss_mod3_upd i.country_elec if p_radicalrl_vs_mainstream==1 ///
|| ccode:, or vce(robust)
est store M4
estadd scalar N_elections = e(N_clust)

melogit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd i.country_elec if p_green_vs_mainstream==0 ///
|| ccode:, or vce(robust)
est store M5
estadd scalar N_elections = e(N_clust)

melogit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined lpss_mod3_upd i.country_elec if p_green_vs_mainstream==1 ///
|| ccode:, or vce(robust)
est store M6
estadd scalar N_elections = e(N_clust)

esttab M1 M2 M3 M4 M5 M6 using "tablea19.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") scalar(N_elections) title(Table A19. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Figure A4**
*************

twoway (scatter lpss_mod3_upd lcorporatism_z_sm537) (lfit lpss_mod3_upd lcorporatism_z_sm537), xtitle("Corporatism t-1") ytitle("Party system saturation t-1") scheme(plotplain) legend(off) name(a, replace)
twoway (scatter lpss_mod3_upd n_sharedrule) (lfit lpss_mod3_upd n_sharedrule), xtitle("Federalism (shared rule) t-1") ytitle("Party system saturation t-1") scheme(plotplain) legend(off) name(b, replace)
twoway (scatter lpss_mod3_upd n_RAI) (lfit lpss_mod3_upd n_RAI), xtitle("Federalism (RAI) t-1") ytitle("Party system saturation t-1") scheme(plotplain) legend(off) name(c, replace)

graph combine a b c, scheme(plotplain)
graph export "figurea4.tif", replace

*************
**Table A20**
*************

/*Corporatism as instrument*/

ivprobit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined (lpss_mod3_upd=lcorporatism_z_sm537) if p_niche==0, first vce(cluster country_elec) 
//t=3.22
display 3.22^2 
est store M1
ivprobit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined (lpss_mod3_upd=lcorporatism_z_sm537) if p_niche==1, first vce(cluster country_elec)
//t=3.89
display 3.89^2
est store M2
ivprobit c_radicalrl_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined (lpss_mod3_upd=lcorporatism_z_sm537) if p_radicalrl_vs_mainstream==0, first vce(cluster country_elec)
//t=3.41
display 3.41^2
est store M3
ivprobit c_mainstream_vs_radicalrl male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotradicallr_combined (lpss_mod3_upd=lcorporatism_z_sm537) if p_radicalrl_vs_mainstream==1, first vce(cluster country_elec)
//t=3.29
display 3.29^2
est store M4
ivprobit c_green_vs_mainstream male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined (lpss_mod3_upd=lcorporatism_z_sm537) if p_green_vs_mainstream==0, first vce(cluster country_elec)
//t=4.45
display 4.45^2
est store M5
ivprobit c_mainstream_vs_green male age i.highedu dissatisfied i.income_3cat distpreviouspartycmp closeparty p_government sd_rile lvotetotgreen_combined (lpss_mod3_upd=lcorporatism_z_sm537) if p_green_vs_mainstream==1, first vce(cluster country_elec)
//t=6.16
display 6.16^2
est store M6

esttab M1 M2 M3 M4 M5 M6 using "tablea20.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") title(Table A20. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1 1 1 1 1 1) replace

*************
**Table A21**
*************

mlogit c_radmainvsniche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_radicalrl_vs_mainstream==0 ///
, baseoutcome(3) vce(cluster country_elec)
est store M1
estadd scalar N_elections = e(N_clust)


esttab M1 using "tablea21.rtf", se aic bic starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles("Main-->Niche" "Niche-->Main" "Main-->Radical" "Radical-->Main" "Main-->Green" "Green-->Main") title(Table A21. Unstandardized models (odds ratios reported)) legend label collabels(none) varlabels(_cons Constant) eform(1) replace

************
**Figure 5**
************

preserve

use "agreementscores_long.dta", clear

rename agr_long agr

drop if agr==.
bys resid: gen n=_n
keep if n==1

reg agr lpss_mod3_upd age male highedu closeparty

margins, at(lpss_mod3_upd=(-4(0.5)2.5)) vsquish post
matrix y_=r(table)'
svmat y_
range g -4 2.5 14

twoway hist lpss_mod3_upd, percent yaxis(2) ///
|| line y_5 g, lcolor(black) lpattern(dash dash) ///
|| line y_6 g, lcolor(black) lpattern(dash dash) ///
|| line y_1 g, lcolor(black) lpattern(solid) ///
, xlabel(-4(0.5)2.5) xtitle("Party system saturation t-1", size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Perceived agreement positions mainstream parties", size(medsmall) axis(1)) ///
legend(off) ///
scheme(plotplain) name(a, replace)

restore

preserve

capture drop sample sample2 inanalysis

bys ccode (alpha_3) : replace alpha_3 = alpha_3[_N]
assert alpha_3!=""

//Merge information on whether CSES party a-i are radical or mainstream
sort alpha_3 elec_year elec_month
merge alpha_3 elec_year elec_month using "partyaf_mainniche.dta", sort uniqus
keep if _merge==3
drop _merge

melogit c_niche male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_niche==0 ///
|| country_elec:, or vce(robust)
gen sample=e(sample)

melogit c_mainstream male age i.highedu i.income_3cat dissatisfied distpreviouspartycmp closeparty p_government sd_rile lvotetotniche_combined lpss_mod3_upd if p_niche==1 ///
|| country_elec:, or vce(robust)
gen sample2=e(sample)

gen inanalysis=1 if sample==1 | sample2==1

keep if inanalysis==1
keep resid lpss_mod3_upd party_a-party_i Aniche_max- Iniche_max Aradical_max-Iradical_max country elec_year male age highedu income disat_demo pol_info closeparty

rename party_a party1
rename party_b party2
rename party_c party3
rename party_d party4
rename party_e party5
rename party_f party6
rename party_g party7
rename party_h party8
rename party_i party9

rename Aradical_max radical1
rename Bradical_max radical2
rename Cradical_max radical3
rename Dradical_max radical4
rename Eradical_max radical5
rename Fradical_max radical6
rename Gradical_max radical7
rename Hradical_max radical8
rename Iradical_max radical9
reshape long party radical, i(resid)
drop if party==.

bys resid: egen zpos=std(party)
replace zpos=(zpos*-1) if zpos<0

reg zpos i.radical##c.lpss_mod3_upd male age highedu pol_info closeparty
margins, at(lpss_mod3_upd=(-4(0.5)2.5) radical=(1)) vsquish post
matrix y_=r(table)'
svmat y_
range g -4 2.5 14

foreach v of varlist y_1-y_9 {
	rename `v' `v'_radical	
}

reg zpos i.radical##c.lpss_mod3_upd male age highedu pol_info closeparty
margins, at(lpss_mod3_upd=(-4(0.5)2.5) radical=(0)) vsquish post
matrix y_=r(table)'
svmat y_

twoway hist lpss_mod3_upd, percent yaxis(2) ///
|| line y_5_radical g, lcolor(black) lpattern(dash dash) ///
|| line y_6_radical g, lcolor(black) lpattern(dash dash) ///
|| line y_1_radical g, lcolor(black) lpattern(solid) ///
|| line y_5 g, lcolor(gs10) lpattern(dash dash) ///
|| line y_6 g, lcolor(gs10) lpattern(dash dash) ///
|| line y_1 g, lcolor(gs10) lpattern(solid) ///
, xlabel(-4(0.5)2.5) xtitle("Party system saturation t-1", size(medsmall)) ///
yscale(alt) yscale(alt axis(2)) ///
ytitle("% of observations", size(medsmall) axis(2)) ///
ytitle("Z-score perceived party position", size(medsmall) axis(1)) ///
legend(order(4 "Radical party" 7 "Mainstream party") ring(0) position(11)) ///
scheme(plotplain) name(b, replace)

restore

graph combine a b, scheme(plotplain) 
graph export "figure5.tif", replace

log close